package com.jack.leetcode.eachproblem_2020;

public class 宝石与石头 {

    public int numJewelsInStones(String J, String S) {
        boolean[] bits = new boolean[128];
        if(J.isEmpty() || S.isEmpty()){
            return 0;
        }
        for (char c : J.toCharArray()) {
            bits[c] = true;
        }
        int result = 0;
        for (char c : S.toCharArray()) {
            if(bits[c]){
                result++;
            }
        }
        return result;
    }
}
